package com.hz.controller;

import com.hz.pojo.Recharge;
import com.hz.service.RechargeService;
import com.hz.utils.MassageJsons;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/Recharge")
public class RechargeController {
    @Resource
    StringRedisTemplate stringRedisTemplate;
    @Resource
    private RechargeService rechargeService;

    @RequestMapping("/getRechargeList")
    public MassageJsons getRechargeList(String open_id){
        List<Recharge> rechargeList = null;
        try {
            rechargeList = rechargeService.getRechargeList(open_id);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return new MassageJsons("0","请求成功",rechargeList);
    }
    @RequestMapping("/udpUserBalance")
    public MassageJsons udpUserBalance(String open_id,Double money){

        return rechargeService.udpUserBalance(open_id,money);
    }
}
